import request from "@/utils/request";

const BASE_URL = "/api/public/mail";

const EmailApi = {
  /**
   *   邮箱验证码
   *
   * @param contact 邮箱
   */
  sendVerificationCode(data?: EmailData) {
    return request({
      url: `${BASE_URL}/captcha`,
      method: "get",
      params: data,
    });
  },

  /**
   * 下次邮箱验证码时间
   *
   * @param contact 邮箱
   */
  captchaTime(id?: string) {
    return request<any, number>({
      url: `${BASE_URL}/captchaTime`,
      method: "get",
      params: { id: id },
    });
  },
};

export default EmailApi;

/** 邮箱发送验证码参数 */
export interface EmailData {
  /** 邮箱 */
  email?: string;
  /** 浏览器指纹 */
  browserId?: string;
}
